<%@ page contentType="text/html; charset=UTF-8" %>

<%@ page import="java.io.*,
                 java.lang.reflect.*,
                 java.util.*,
                 com.dd.*,java.util.ArrayList, java.util.Map,com.chantel.tool.db.PageData"
%>
<%@ include file="global.jsp" %>
<%
PageData pd = null; 
int pageSize = 10;
String mingCheng = request.getParameter("mingCheng");
int ziduanming = ParamUtils.getIntParameter(request,"ziduanming",-1);

int tabIndex = 1;
if(ziduanming != -1)
	tabIndex = ziduanming;

String p1=request.getParameter("p1")==null ? "0":request.getParameter("p1");
int nP1=Integer.parseInt(p1);

// to add 分页
if(null == mingCheng)
{
	mingCheng = "";
	//pd = PageControl.GetAllCaiGouBaoJiaDan(nP1, pageSize, pageUser.getId());
}
else
{
	//mingCheng = new String(mingCheng.getBytes("ISO8859_1"), "GBK").trim();
	pd = PageControl.GetCaiGouBaoJiaDanByMingCheng(mingCheng, nP1, pageSize, pageUser.getId(),ziduanming);
}
%>

<html>
<head>
<title>高级查询</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/basic.css" rel="stylesheet" type="text/css" />
</head>
<body bgcolor="#ffffff">
<h1>
  <table width=70% height="40"  border="0" cellpadding="0" cellspacing="0">
			<form name="form1" method="post" action="AdvanceResearch.jsp">
              <tr align="center">
                <td width="25%" >选择查询字段：</td>
                <td width="25%" ><select name="ziduanming"
					id="ziduanming">
					<%if(tabIndex == 1){%>
					<option value=1>表单名称</option>
					<option value=2>项目名称</option>
				    <option value=3>单据表号</option>
				    <%} %>
				    <%if(tabIndex == 2){%>
				    <option value=2>项目名称</option>
					<option value=1>表单名称</option>
				    <option value=3>单据表号</option>
				    <%} %>
				    <%if(tabIndex == 3){%>
				    <option value=3>单据表号</option>
				    <option value=1>表单名称</option>
				    <option value=2>项目名称</option>
				    <%} %>

				   </select></td>
                <td width="50%">
                  <input name="mingCheng" type="text" size="40" value="<%=mingCheng%>">
                  <input name="Submit" type="submit" value="查询"></td>
              </tr>
			</form>
			      </table>	
<%
if(null != pd)
{
	int RecordCount=pd.rowCount; 
	if(RecordCount <= 0){
		out.println("没有找到[ "+mingCheng+" ]的信息！");}
	else{
%>
<table width="80%" height="48"  border="1" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" bordercolordark="#CCCCCC" bordercolorlight="#FFFFFF">
                    <tr align="center">
                      <td width="10%" height="30">单据表号</td>
                      <td width="10%">表单名称</td>
                      <td width="10%">创建时间</td>
                      <td width="10%">项目名称</td>
                      <td width="10%">表状态</td>
                    </tr>
<%
    List li = pd.data;
    for(int i = 0; i < li.size(); i++)
    {   
	      Map m = (Map)li.get(i);%>
		<tr align="center">
		  <td ><A href="sh_cgbj.jsp?CaiGouBiaoId=<%=m.get("CaiGouBiaoId") %>"
                        target=_blank><%=m.get("DanJuBiaoHao")%></A></td>
		  <td><%=m.get("BiaoMingCheng")%></td>
		  <td><%=m.get("ChuangJianShiJian")%></td>
		  <td><%=m.get("XiangMuMingCheng")%></td>
		  <td><%=SysGlobals.TransferBiaoZhuangTai((String)m.get("BiaoZhuangTai"))%></td>
		</tr>
<%}%>
            </table>
<%}%>
  <tr align = "right"><td style="WIDTH: 300x"><%if(pd.bBefore){%><a href="AdvanceResearch.jsp?p1=0">首页</a> <a href="AdvanceResearch.jsp?p1=<%=nP1-1%>">上一页</a> <%}%> 
         <%if(pd.pageCount > 1){%><%=nP1+1 %>/<%=pd.getPageCount() %><%}%>
         <%if(pd.bNext){%><a href="AdvanceResearch.jsp?p1=<%=nP1+1 %>">下一页</a> <a href="AdvanceResearch.jsp?p1=<%=pd.getPageCount()-1%>">末页</a><%}}%></td></tr>
</h1>
</body>
</html>

